package com.atguigu.jxc.service.impl;
import com.atguigu.jxc.dao.CustomerDao;
import com.atguigu.jxc.entity.Customer;
import com.atguigu.jxc.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    CustomerDao customerDao;
    @Override
    public List<Customer> list(Integer page, Integer rows, String customerName) {
       List<Customer> customers = customerDao.list(page,rows,customerName);
        return customers;
    }

    @Override
    public void save(Customer customer) {
        if(customer.getCustomerId()!=null){
            customerDao.update(customer);
        }else{
            customerDao.save(customer);
        }
    }

    @Override
    public void delete(List ids) {
        customerDao.delete(ids);
    }
}
